﻿<UserControl x:Class="USMC.Net.RouteCanvas"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" Name="pathCanvas">
    <Grid ClipToBounds="True" Name="mainGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Rectangle Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" Grid.RowSpan="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="#FFAAB5BD" />
        <StackPanel Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left">
            <Label>Масштаб</Label>
            <Button HorizontalAlignment="Center" Width="20" PreviewMouseDown="Button_Click" KeyDown="Button_KeyDown">+</Button>
            <Slider Orientation="Vertical" Height="100" HorizontalAlignment="Center" Minimum="-5" Name="zoomSlider" ValueChanged="zoomSlider_ValueChanged" Maximum="5"></Slider>
            <Button HorizontalAlignment="Center" Width="20" PreviewMouseDown="Button_Click_1">-</Button>
            <TextBox HorizontalAlignment="Center" Name="zoomLabel" Text="1" KeyDown="zoomLabel_KeyDown" />
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="1" ClipToBounds="True">
            <Image Width="40" VerticalAlignment="Top" Name="verticalBar" Height="500" Stretch="Fill">
            </Image>
        </StackPanel>
        <StackPanel Grid.Row="0" Grid.Column="2" ClipToBounds="True">
            <Image Height="40" HorizontalAlignment="Left" Name="horizontalBar" Width="500" Stretch="Fill" />
        </StackPanel>
        <ScrollViewer Name="scroller" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="2" Grid.Row="1" ScrollChanged="scroller_ScrollChanged" PreviewKeyDown="scroller_PreviewKeyDown">
            <Grid>
                <Canvas Name="mainCanvas" VerticalAlignment="Top" HorizontalAlignment="Left" Width="500" Height="500" Grid.Row="0" Grid.Column="0" MouseMove="mainCanvas_MouseMove" MouseLeftButtonDown="mainCanvas_MouseLeftButtonDown">
                    <Image Name="backImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Canvas.Left="0" Canvas.Top="0" Width="500" Height="500" MouseWheel="Rectangle_MouseWheel" />
                </Canvas>
                <Canvas Name="pointsCanvas" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="500" Height="500" LayoutTransform="{Binding ElementName=mainCanvas, Path=LayoutTransform}" MouseMove="point_MouseMove" MouseRightButtonDown="pointsCanvas_MouseRightButtonDown">
                    <!-- <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Canvas.Left="0" Canvas.Top="0" Width="500" Height="500" Fill="Black"/>-->
                    <Canvas.ContextMenu>
                        <ContextMenu Name="contextMenu1">
                            <MenuItem Click="removeMenuItem_Click" Header="Удалить выбранное"></MenuItem>
                            <MenuItem Visibility="Collapsed" Name="cycleMenuItem" Click="cycleMenuItem_Click" Header="Сформировать цикл"></MenuItem>
                        </ContextMenu>
                    </Canvas.ContextMenu>
                </Canvas>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
